package reflect.web.project01;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class Calculation {
    static Numbers numbers;
    public static void createNum(int num1,int num2,int num3) throws Exception {
        numbers=new Numbers();
        Class c= Numbers.class;
        Field min=c.getDeclaredField("min");
        Field max=c.getDeclaredField("max");
        Field mid=c.getDeclaredField("mid");

        min.setAccessible(true);
        max.setAccessible(true);
        mid.setAccessible(true);

        min.set(numbers,num3);
        max.set(numbers,num1);
        mid.set(numbers,num2);
//        System.out.println(numbers);
    }
    public static void solve(String expression) throws Exception {
        Class<Numbers> numbersClass = Numbers.class;
        Method method = numbersClass.getMethod(expression);
        method.invoke(numbers);
    }
}
